<legend id='CGSNo'><style id='CGSNo'><dir id='CGSNo'><q id='CGSNo'></q></dir></style></legend>

      <bdo id='CGSNo'></bdo><ul id='CGSNo'></ul>
    <tfoot id='CGSNo'></tfoot>

  1. <small id='CGSNo'></small><noframes id='CGSNo'>

      <i id='CGSNo'><tr id='CGSNo'><dt id='CGSNo'><q id='CGSNo'><span id='CGSNo'><b id='CGSNo'><form id='CGSNo'><ins id='CGSNo'></ins><ul id='CGSNo'></ul><sub id='CGSNo'></sub></form><legend id='CGSNo'></legend><bdo id='CGSNo'><pre id='CGSNo'><center id='CGSNo'></center></pre></bdo></b><th id='CGSNo'></th></span></q></dt></tr></i><div id='CGSNo'><tfoot id='CGSNo'></tfoot><dl id='CGSNo'><fieldset id='CGSNo'></fieldset></dl></div>
    1. 在使用 imagecache_create_path &amp; 之前使用 Drupal imagecache

      Generate image with Drupal imagecache before using imagecache_create_path amp; getimagesize(在使用 imagecache_create_path amp; 之前使用 Drupal imagecache 生成图像获取图像大小)
      <legend id='oqoXI'><style id='oqoXI'><dir id='oqoXI'><q id='oqoXI'></q></dir></style></legend>
          <tbody id='oqoXI'></tbody>

        <tfoot id='oqoXI'></tfoot>

        <i id='oqoXI'><tr id='oqoXI'><dt id='oqoXI'><q id='oqoXI'><span id='oqoXI'><b id='oqoXI'><form id='oqoXI'><ins id='oqoXI'></ins><ul id='oqoXI'></ul><sub id='oqoXI'></sub></form><legend id='oqoXI'></legend><bdo id='oqoXI'><pre id='oqoXI'><center id='oqoXI'></center></pre></bdo></b><th id='oqoXI'></th></span></q></dt></tr></i><div id='oqoXI'><tfoot id='oqoXI'></tfoot><dl id='oqoXI'><fieldset id='oqoXI'></fieldset></dl></div>

        <small id='oqoXI'></small><noframes id='oqoXI'>

                <bdo id='oqoXI'></bdo><ul id='oqoXI'></ul>
              • 本文介绍了在使用 imagecache_create_path &amp; 之前使用 Drupal imagecache 生成图像获取图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 imagecache_create_path() 和 getimagesize() 来获取图像缓存生成的图像的路径及其尺寸.但是,如果这是我们第一次访问该图像尚不存在的页面并且 imagecache_create_path 也不会生成它.

                I'm using imagecache_create_path() and getimagesize() to get the path of a imagecache-generated image and its dimensions. However, if it's the first time we access the page that image doesn't exist yet and imagecache_create_path doesn't generate it either.

                代码如下:

                // we get the image path from a preset (always return the path even if the file doesn't exist)
                $small_image_path = imagecache_create_path('gallery_image_small', $image["filepath"]);
                // I get the image dimensions (only if the file exists already)
                $data_small = list($width, $height, $type, $image_attributes) = @getimagesize($small_image_path);
                

                是否有任何 API 方法来获取路径并生成文件?换句话说,我可以从 PHP 生成图像(使用预设)而不在浏览器中显示它吗?

                Is there any API method to get the path AND generate the file? In other words, can I generate the image (using a preset) from PHP without showing it in the browser?

                提前致谢

                推荐答案

                检查 imagecache_build_derivative() 函数及其在 imagecache.module 中的用法.对于您的情况,它应该大致如下工作:

                Check the imagecache_build_derivative() function and its usage in imagecache.module. For your case, it should work roughly like so:

                $presetname = 'gallery_image_small';
                $preset = imagecache_preset_by_name($presetname);
                $src = $image["filepath"];
                $dst = imagecache_create_path($presetname, $src);
                // Ensure existing derivative or try to create it on the fly
                if (file_exists($dst) || imagecache_build_derivative($preset['actions'], $src, $dst)) {
                  // Do what you need to do with the image
                }
                

                (注意:未经测试的代码,注意错别字和其他错误/疏忽)

                (NOTE: untested code, beware of typos and other errors/oversights)

                这篇关于在使用 imagecache_create_path &amp; 之前使用 Drupal imagecache 生成图像获取图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                • <legend id='9PFRV'><style id='9PFRV'><dir id='9PFRV'><q id='9PFRV'></q></dir></style></legend>

                  <small id='9PFRV'></small><noframes id='9PFRV'>

                    <tbody id='9PFRV'></tbody>
                  <tfoot id='9PFRV'></tfoot>
                      <bdo id='9PFRV'></bdo><ul id='9PFRV'></ul>

                        <i id='9PFRV'><tr id='9PFRV'><dt id='9PFRV'><q id='9PFRV'><span id='9PFRV'><b id='9PFRV'><form id='9PFRV'><ins id='9PFRV'></ins><ul id='9PFRV'></ul><sub id='9PFRV'></sub></form><legend id='9PFRV'></legend><bdo id='9PFRV'><pre id='9PFRV'><center id='9PFRV'></center></pre></bdo></b><th id='9PFRV'></th></span></q></dt></tr></i><div id='9PFRV'><tfoot id='9PFRV'></tfoot><dl id='9PFRV'><fieldset id='9PFRV'></fieldset></dl></div>